public class Leetcode127 {
    public static void main(String[] args) {
        System.out.println(trailingZeroes(5));
    }

//        public static int trailingZeroes(int n) {
//        int count = 0;
//        while (n > 0) {
//            count += n / 5;
//            n /= 5;
//        }
//
//        return count;
//    }
//    public static int trailingZeroes(int n) {
//        return n == 0 ? 0 : n / 5 + trailingZeroes(n / 5);
//    }

    public static int trailingZeroes(int n) {
        return n / 5 + n / 25 + n / 125 + n / 625 + n / 3125;
    }
}
